package com.comleader.uap.controller;

import java.io.IOException;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import com.comleader.common.core.web.page.PageResult;
import com.comleader.uap.common.page.PageQuery;
import com.comleader.uap.common.response.Result;
import com.comleader.uap.pojo.query.AppAnalyseQuery;
import com.comleader.uap.pojo.vo.AppAnalyseVO;
import com.comleader.uap.service.AppAnalyseService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

/**
 * @Description 涉诈APP分析
 * @Auhtor 王坤
 * @Date 2024/11/26 18:01
 */
@Api(tags = "涉诈APP分析")
@Validated
@RestController
@RequestMapping("/app-analyse")
public class AppAnalyseController {

    @Resource
    private AppAnalyseService appAnalyseService;

    /**
     * @Description 查询涉诈类型
     * @Auhtor 王坤
     * @Date 2024/11/27 16:05
     * @return
     */
    @ApiOperation(value = "查询涉诈类型")
    @GetMapping("/queryLabelType")
    public Result<List<String>> queryLabelType() {
        List<String> list = appAnalyseService.queryLabelType();
        return Result.success(list);
    }

    /**
     * @Description 分页查询
     * @Auhtor 王坤
     * @Date 2024/11/26 18:01
     * @param query
     * @return
     */
    @ApiOperation(value = "分页查询")
    @PostMapping("/list")
    public Result<PageResult<AppAnalyseVO>> list(@Valid @RequestBody PageQuery<AppAnalyseQuery> query) {
        return Result.success(appAnalyseService.selectList(query));
    }

    /**
     * @Description 导出
     * @Auhtor 王坤
     * @Date 2024/11/28 18:33
     * @param query
     * @param response
     */
    @ApiOperation(value = "导出")
    @PostMapping("/export")
    public void export(@RequestBody AppAnalyseQuery query, HttpServletResponse response) throws IOException {
        appAnalyseService.export(query, response);
    }

}
